package rmi;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import java.util.Iterator;

import observer.ObserverRemotoREST;



public abstract class ModeloRemoto extends UnicastRemoteObject {

		private static final long serialVersionUID = 1L;
		private ArrayList<ObserverRemotoREST> observersCPR = new ArrayList<ObserverRemotoREST>();
		
		
		protected ModeloRemoto() throws RemoteException {
			super();

		}

		public void addObserverRemotoCPR(ObserverRemotoREST observer)throws RemoteException
		{
			observersCPR.add(observer);
		}

		public void removeObserverRemotoCPR(ObserverRemotoREST observer)throws RemoteException
		{
			observersCPR.remove(observer);
		}
		
		public void notifyObserverRemotoCPR()throws RemoteException
		{
			for(Iterator<ObserverRemotoREST> i = observersCPR.iterator();i.hasNext();)
			{
				i.next().update();
			}
		}
		
		
	}


